home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / cuj0593.zip / 1105084A < prev    next >
Text File  |  1993-03-16  |  970b  |  56 lines

  1. // fv2.h - a dynamic vector of float (with a possibly
  2. // non-zero low-bound) using a subscripting object
  3. // implemented by aggregation with a float_array member
  4.  
  5. #include "fa1.h"
  6.  
  7. class float_vector
  8.     {
  9. public:
  10.     float_vector(int lo = 0, int hi = 0);
  11.     float operator[](int i) const;
  12.     fa_index operator[](int i);
  13.     size_t length() const;
  14.     int low() const;
  15.     int high() const;
  16.     operator float_array &();
  17.     operator const float_array &() const;
  18. private:
  19.     float_array fa;
  20.     int _low;
  21.     };
  22.  
  23. inline float_vector::float_vector(int lo, int hi)
  24.     : _low(lo), fa(hi - lo + 1)
  25.     { }
  26.  
  27. inline size_t float_vector::length() const
  28.     {
  29.     return fa.length();
  30.     }
  31.  
  32. inline int float_vector::low() const
  33.     {
  34.     return _low;
  35.     }
  36.  
  37. inline int float_vector::high() const
  38.     {
  39.     return _low + fa.length() - 1;
  40.     }
  41.  
  42. inline float_vector::operator float_array &()
  43.     {
  44.     return fa;
  45.     }
  46.  
  47. inline
  48. float_vector::operator const float_array &() const
  49.     {
  50.     return fa;
  51.     }
  52.  
  53.  
  54.  
  55.  
  56.